﻿<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
		<title>Web报表(B/S报表)演示, 实现汇总报表向明细报表的透视(AJAX方式)</title>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
		<script src="../../CreateControl.js" type="text/javascript"></script>
	    <script src="../../GRUtility.js" type="text/javascript"></script>
		<script type="text/javascript">
//在网页初始加载时启动报表的运行显示
function window_onload() 
{
	btnRefresh_onclick();
}

//打印预览报表
function btnPreview_onclick() 
{
    ReportViewer.Report.PrintPreview(true);
}

//根据数据过滤参数重新显示报表
function btnRefresh_onclick() 
{
    var BeginDate = document.getElementById("txtBeginDate").value;
    var EndDate = document.getElementById("txtEndDate").value;
    
    //更新查询参数更新报表付标题，设置对应静态框的“Text”属性
    ReportViewer.Report.ControlByName("SubTitle").AsStaticBox.Text = "日期范围：" + BeginDate + "至" + EndDate;
    
    var DataURL = encodeURI("../../10.SummaryToDetail/xmlSummary.jsp?BeginDate=" + BeginDate + "&EndDate=" + EndDate);
    AjaxReportViewerStart(ReportViewer, DataURL);
}

//打开当前行对应的明细报表
function btnDrillDown_onclick() 
{
    var ProductID = ReportViewer.Report.FieldByName("ProductID").AsInteger;
    var BeginDate = document.getElementById("txtBeginDate").value;
    var EndDate = document.getElementById("txtEndDate").value;
    var URL = "Detail.jsp?ProductID=" + ProductID + "&BeginDate='" + BeginDate + "'&EndDate='" + EndDate + "'";
	window.open(URL, "_blank");
}

function OnContentCellDblClick(Sender) //响应内容行双击事件，打开当前行对应的明细报表 
{
	btnDrillDown_onclick();
}
	</script>
    <style type="text/css">
        html,body {
            margin:0;
            height:100%;
        }
    </style>
</head>
<body style="margin:0; background-color: #f0ffff;" onload="window_onload()">
	<table border="0" width="100%" height="100%">
		<tr style="width: 100%;">
			<td style="font-size: 10pt; height: 23px; width: 50%;">开始日期：<input id="txtBeginDate" type="text" value="1997-1-1" name="txtBeginDate" maxlength="20" style="width: 84px">
                结束日期：<input id="txtEndDate" type="text" value="1997-12-31" name="txtEndDate" maxlength="20" style="width: 80px"/>
                <input id="btnRefresh" onclick="return btnRefresh_onclick()" type="button" value="更新显示"
					name="btnRefresh"/></td>
			<td style="font-size: 10pt; height: 23px; width:50%;">
                <input id="btnPreview" onclick="return btnPreview_onclick()" type="button" value="打印预览"
					name="btnPreview"/>
                <input id="btnDrillDown" onclick="return btnDrillDown_onclick()" type="button" value="明细报表"
					name="btnDrillDown"/></td>
		</tr>
        <tr style="height: 100%;">
            <td colspan="5" style="font-size: 10pt;">
                <script type="text/javascript"> 
                    CreateDisplayViewerEx("100%", "100%", "../../10.SummaryToDetail/Summary.grf", "", false, "<param name=BorderStyle value=1>" +
                        "<param name='OnContentCellDblClick' value='OnContentCellDblClick'>");
                </script>
            </td>
        </tr>
	</table>
</body>
</html>
